﻿namespace BankExercise
{
    using System;

    public class DepositAcc : Account, IDepositable
    {
        public override void Deposit(decimal sumToDeposit)
        {
            base.Deposit(sumToDeposit);
        }

        internal override void WithDraw(decimal sumToWithDraw)
        {
 	         base.WithDraw(sumToWithDraw);
        }

        internal override decimal CalculateInterest(int periodInMonths)
        {
            if (this.InterestRatePerMonth == 0)
            {
                throw new InvalidOperationException("No way you do that: calculate interest amount before you have set an intereset index.");
            }
            else
            {
                if (this.Balance < 1000)
                {
                    return 0;
                }
                else
                {
                    return this.interestRatePerMonth * periodInMonths;
                }
            }
        }
    }
}